package tag18_04_08.mvcAufgabe.console;

import tag18_04_08.mvcAufgabe.Position;
import tag18_04_08.mvcAufgabe.TicTacToe;



public class ControllerConsole {

	public static void main(String[] args) {
		
		TicTacToe game = new TicTacToe(3);
		
		while(!game.isGameOver()) 
		{
			
			ViewConsole.print(game);

			//User move
			Position userPos = ViewConsole.getNextUserPosition(game);
			game.moveUser(userPos);
			
			//Check is over
			if( game.isGameOver() )
				break;
			
			//AI move
			game.moveAi();
		}
		
		ViewConsole.print("-------- Endstand: ----------");
		
		if( game.isWinnerUser() ) {
			ViewConsole.print("Sie haben gewonnen!");
		} else if( game.isWinnerAi() ) {
			ViewConsole.print("Sie haben verloren :(");
		} else {
			ViewConsole.print("Unentschieden");
		}
		
		ViewConsole.print(game);
		
	} //end of main

}
